package tang.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import tang.domain.Goods;

/*feign的声明式接口,发起远程调用
* 替换
*       String url= "http://FEIGN-PROVIDER/Goods/findOne/"+id;
        Goods goods = restTemplate.getForObject(url, Goods.class);
* */

@FeignClient(value ="FEIGN-PROVIDER" )   //替换//FEIGN-PROVIDER
public interface GoodsFeignclient {

    @GetMapping("/Goods/findOne/{id}")  //替换/Goods/findOne/"+id;
    public Goods findOne(@PathVariable("id") int id);
}
